package com.atgui.yygh.controller;

import com.atgui.yygh.model.hosp.Hospital;
import com.atgui.yygh.service.HospitalService;
import com.atgui.yygh.vo.hosp.HospitalQueryVo;
import com.atgui.yygh.vo.hosp.HospitalSetQueryVo;
import com.atguigu.yygh.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * zz: wzh
 * time 2022 09 04 14 43
 **/
@RestController
@RequestMapping("/admin/hosp/hospital")
//@CrossOrigin
public class HospitalController {
    @Autowired
    private HospitalService hospitalService;
    //医院列表查询接口
    @GetMapping("list/{page}/{limit}")
    public Result listHosp(@PathVariable Integer page,
                           @PathVariable Integer limit,
                           HospitalQueryVo hospitalQueryVo){
        Page<Hospital> pageModel=hospitalService.selectHospPage(page,limit,hospitalQueryVo);
        return Result.ok(pageModel);
    }
    //更新医院上线状态
    @GetMapping("updataHospStatus/{id}/{status}")
    public Result updateHospStatus(@PathVariable String id,@PathVariable Integer status){
        hospitalService.updateStatus(id,status);
        return Result.ok();
    }
    //医院详情 信息
    @GetMapping("showHospDetail/{id}")
    public Result showHospDetail(@PathVariable String id){
        Map<String,Object> map=hospitalService.getHospById(id);
        return Result.ok(map);
    }
}
